
package com.wyzz.hr.action;

import java.util.List;

import com.wyzz.hr.base.BaseAction;
import com.wyzz.hr.base.FileOperate;
import com.wyzz.hr.bo.IRecruitapplierBo;
import com.wyzz.hr.pojo.Recruitapplier;

public class RecruitapplierDelete extends BaseAction {

	public RecruitapplierDelete() {
	}

	public String execute() throws Exception {
		IRecruitapplierBo recruitapplierBo = (IRecruitapplierBo) getBean("applierBo");
		Recruitapplier tempRa = recruitapplierBo.loadApplier(applierId, null);
		if (tempRa != null
				&& recruitapplierBo.deleteApplier(new String[] { applierId })
						.size() < 1) {
			FileOperate.deleteFile("sys.recruitment.applier.path", tempRa
					.getRecaAttachmentName());
			addSuccessInfo((new StringBuilder()).append(
					"\u5220\u9664\u5E94\u8058\u8005").append(
					tempRa.getRecaName()).append("\u6210\u529F\u3002")
					.toString());
			tempRa = null;
			return "success";
		} else {
			tempRa = null;
			return "error";
		}
	}

	public String dwrDelte(String id) {
		IRecruitapplierBo recruitapplierBo = (IRecruitapplierBo) getBean("applierBo");
		Recruitapplier tempRa = recruitapplierBo.loadApplier(id, null);
		String recaName = "";
		if (tempRa != null)
			recaName = tempRa.getRecaName();
		if (tempRa != null
				&& recruitapplierBo.deleteApplier(new String[] { id }).size() < 1) {
			FileOperate.deleteFile("sys.recruitment.applier.path", tempRa
					.getRecaAttachmentName());
			tempRa = null;
			return (new StringBuilder()).append(
					"\u5220\u9664\u5E94\u8058\u8005(").append(recaName).append(
					")\u6210\u529F\u3002").toString();
		} else {
			tempRa = null;
			return (new StringBuilder()).append(
					"\u5220\u9664\u5E94\u8058\u8005(").append(recaName).append(
					")\u5931\u8D25\u3002").toString();
		}
	}

	public String getApplierId() {
		return applierId;
	}

	public void setApplierId(String applierId) {
		this.applierId = applierId;
	}

	private String applierId;
}
